/*
 * main.cpp
 *
 *  Created on: Sep 13, 2016
 *      Author: root
 */
#include "base/net/yNetServer.h"
#include "gateway/GateWayDispatcher.h"
#include "base/tools/yDebugTools.h"
#include "base/log/yLog.h"
#include "base/concurrent/yExecutorService.h"
#include "base/database/yDBManager.h"
#include "base/redis/yRedisManager.h"
#include "base/concurrent/yThread.h"
void testTask(void * param) {
	Log::error((char*) param);
}
void testThread(Thread*t) {
	while (true) {
		Log::error("dihfukdhfjkahkjdashfkjashkjdsh");
		t->sleep(1000);
	}
}
int main(int argc, char * const argv[]) {
	Log::init(argv[0]);
//	setCrashHook();
//	task* tsk = (task*) malloc(sizeof(task));
//	tsk->data = const_cast<char*>("dfgsfgsdgdsfrert");
//	tsk->rFun = &testTask;
//	ExecutorService* executor = ExecutorService::newFixedThreadPool(10);
//	executor->excute(tsk);
	//NetServer* server = new NetServer(8849);
	//server->dispatcher = new GateWayDispatcher();
	//server->start();
	Thread* t=new Thread(&testThread);
	t->start();
	NetServer* server = new NetServer(8849);
	server->dispatcher = new GateWayDispatcher();
	server->start();
	Log::end();
	return 0;
}

